<?php

namespace App\Models\shop;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Product extends Model
{
    //软删除
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    //
    //黑名单
    protected $guarded = ['_token','content1','content2'];


    //每个商品属于某个品牌
    public function brand()
    {
        return $this->belongsTo('App\Models\shop\Brand','brand_id');
    }

    //每个商品属于某个分类
    public function category()
    {
        return $this->belongsTo('App\Models\shop\goodscategory','category_id');
    }

    //一个商品有很多相册图片
    public function product_gallery()
    {
        return $this->hasMany('App\Models\shop\product_gallery');
        
    }

}
